﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;

using EzDesk.Generic.WPF;


namespace EzDesk.MVVMBase
{
    public class WindowExtenBase:Window,IWindowView
    {
        public WindowExtenBase()
        {
            InitEvent();
        }

        private void InitEvent()
        {
            this.LostFocus += WindowExtenBase_LostFocus;
        }

        void WindowExtenBase_LostFocus(object sender, RoutedEventArgs e)
        {
            Topmost =  false;
        }


        public virtual IWindowView ShowWindowView()
        {
            Show();
            return this;
        }

        public virtual IWindowView MinimizeWindowView()
        {
            this.WindowState = WindowState.Minimized;
            return this;
        }

        public virtual IWindowView HideWindowView()
        {
            Hide();
            return this;
        }

        public virtual IWindowView CloseWindowView()
        {
            Close();
            return this;
        }

        public object ViewModel
        {
            get
            {
                return this.DataContext;
            }
            set
            {
                this.DataContext = value;
            }
        }
    }
}
